home *** CD-ROM | disk | FTP | other *** search
/ MACup: Giveaway 1996 / Image.iso / Shareware & Demos / Web-Publishing / SNAP PrimeBase / Telephone & Tabler / About Tabler next >
Encoding:
Text File  |  1996-07-15  |  9.9 KB  |  222 lines  |  [TEXT/ttxt]

  1. Notes on Tabler
  2.  
  3. Tabler is a DAL controlled front-end. It may be used to quickly create an interface to an existing database schema.
  4.  
  5. The following is a Tabler "program", that lists the database available on the server:
  6.  
  7. #LOGIN
  8.  
  9. declare integer $DefCols = 1;    
  10. declare integer $ClearRows = 2;    
  11. declare integer $AddRow = 8;    
  12.  
  13. #WINDOW "W1" "Databases"
  14.  
  15. print $DefCols, 1, "Name";
  16.  
  17. describe databases into c1;
  18. for each c1
  19.     print $AddRow, c1->name;
  20.  
  21. Try it out, copy the text above, and place it is a text file. Drag the file to tabler. Make sure that you have defined a connection to your server (using ConnectionSetup).
  22.  
  23. What does the program do?
  24.  
  25. Firstly, it defines 2 "events": LOGIN and WINDOW. The LOGIN event occurs when tabler starts, immediatly after the login dialog. A WINDOW event occurs after after login for each window event defined in the Tabler program.
  26.  
  27. When an event occurs, Tabler executes the DAL program that defines the action of the event. For example, the LOGIN event above executes a DAL program that declares 3 integer values $DefCols; $ClearRows and $AddRow.
  28.  
  29. The WINDOW event does 2 things, it define the columns of the list box, and fills the list box with the names of the databases.
  30.  
  31. The standard Tabler window
  32.  
  33. Tabler only has one type of window (besides alert boxes and dialogs). The window contains 4 buttons, 2 popups, one hash list, a text field and a list box. Although these elements are fixed, the contents and actions resulting from the controls is determined by the tabler program.
  34.  
  35. The role of the DAL session
  36.  
  37. The DAL session is the controlling entity that co-ordinates the interaction between the Tabler windows (the user-interface), and the database (the back-end). The DAL session should ensure that the values displayed to the user, the values of global variables in the DAL session, and the values stored in the database remain sycronized.
  38.  
  39. To do this, Tabler defines 3 elements:
  40.  
  41. • EVENTS - The result of actions initiated by the user (for example, the user pressed the Update button). Events names begin with a '#'.
  42.  
  43. • COMMANDS - An instruction sent by the DAL session to the user-interface (for example, tell the user interface to enable a button). Command names customarily begin with a '$'.
  44.  
  45. • VALUES - Current values of certain controls in the Tables windows may be "read" by the DAL session. For example, the value in the text field, or which popup is selected. Values beign with an '@' symbol.
  46.  
  47. EVENTS
  48.  
  49. This is a list of all events that can occur in Tabler.
  50.  
  51. #LOGIN
  52.  
  53. This event occurs when a Tabler program starts, after the Login Dialog. It is the first event in a Tabler program, and should be used to declare and initialize global application data and procedures. Do not attempt to access any windows at this stage, as none exist at this point.
  54.  
  55. You may only define one #LOGIN event per application.
  56.  
  57. #ERROR
  58.  
  59. This event occurs after an error occurs in the DAL program. It may be used to attempt to handle the error. Be careful not to have any errors in the DAL program of this event.
  60.  
  61. An #ERROR event may be defined for the application, and for each window. Define #ERROR events for windows below the definition of the #WINDOW event. Place the #ERROR event for the application above all window event definitions.
  62.  
  63. If an #ERROR event does not exist for a particular window, then the application error event is called.
  64.  
  65. #ALERT
  66.  
  67. The #ALERT event is occures after an alert box (other than an error alert). It may be used to respond to the result of the alert. For example, an Alert may ask the user if an item should be deleted or not.  The only way to respond to the users choice is to use the #ALERT event.
  68.  
  69. #ALERT events may be defined for each window, and for the application. If a window alert has not been defined, then the application alert will be called.
  70.  
  71. #WINDOW <name> <title>
  72.  
  73. This event occurs once at the start of the Tabler program for each window. Two string arguments specify the name and title of the window. The name is used as an internal reference. The title appears in the window on screen.
  74.  
  75. You should use this event to initialize the window control elements.
  76.  
  77. NOTE: All events defined following the window event are associated with that window. You may define #SELECT, #INSERT, #PICK, etc. events for each window.
  78.  
  79. #SELECT
  80.  
  81. This event occurs when the user presses the Select Button in the window. 
  82.  
  83. #INSERT
  84.  
  85. This event occurs when the user presses the Insert Button in the window.
  86.  
  87. #UPDATE
  88.  
  89. This event occurs when the user presses the Update Button in the window.
  90.  
  91. #DELETE
  92.  
  93. This event occurs when the user presses the Delete Button in the window.
  94.  
  95. #PICK
  96.  
  97. The #PICK event occurs when the user selects a new column of row. Columns are selected using the top-left popup which always contains a list of the columns defined for the list box. A row is selected in the list box itself. The current row is highlighted.
  98.  
  99. Columns are number 1 to n (where n is number of columns defined for the list box) and rows are number 1 to m (where m is the number of rows currently in the list box). It is possible that no row is selected, or that the list box is empty. In this case the current row is zero.
  100.  
  101. #GRAB
  102.  
  103. The #GRAB event occurs when the user double-clicks a row in the list box. As with all other events, it is up to the Tabler application to define the effect of the double-click.
  104.  
  105. VALUES
  106.  
  107. Here is a list of the values that can be read from the front-end. Only the values of the window in which the event has occurred may be read by the application.
  108.  
  109. @ROW
  110.  
  111. The current row. An integer value from zero to m, where m is the number of rows currently in the list box. Zero is returned if no row is selected, or there are no rows in the list box.
  112.  
  113. The selected column is highlighted in the list box.
  114.  
  115. @COL
  116.  
  117. The current column. This value is determined by what is selected in the top-left popup. If no columns have been defined for the window, then the value contains zero. Otherwize it contain a value from 1 to n, where n is the number of columns currently defined for the list box.
  118.  
  119. @TEXT
  120.  
  121. The current value in the text field of the window. It also represents the value selected in the hash-list above the text field, as the text field is alway set to the value selected in the hash-list.
  122.  
  123. @POPUP
  124.  
  125. Contains the string value of the currently selected value in the top-right popup control. The function and contents of this popup is completely defined by the Tabler program.
  126.  
  127.  @HOW
  128.  
  129. Contains a number which represents how an #ALERT or #ERROR event occurred. In the case of an #ERROR event, it contains the primary error code, and in the case of an #ALERT event it contains the users selection, 1, 2 or 3, depending on which button was pressed by the user in the Alert Window.
  130.  
  131. COMMANDS
  132.  
  133. All output from the DAL session must be preceeded by a command number which specifies what the front-end should do with the values. The values following the command number are the arguments of the command.
  134.  
  135. 1 = $DefCols, <count> { , <title> }
  136.  
  137. Define the columns for the list box. This functions also deletes all rows currently in the list box. The first argument, <count>, is the number of columns. This is followed by the title of each column (<count> must be given).
  138.  
  139. Columns defined appear at the top of the list box, and in the top-left popup, where a column may be selected.
  140.  
  141. 2 = $ClearRows
  142.  
  143. Deletes all rows in the list box.
  144.  
  145. 3 = $SetTitle,    <col>, <title>
  146.  
  147. Sets the title of a particular column that has already been defined. <col> is the column number of the title to be set.
  148.  
  149. 4 = $EnableBut, <select>, <insert>, <update>, <delete>
  150.  
  151. Enables (when value is 1) or disables (when value is 0) the window buttons. Initially, all buttons are disabled.
  152.  
  153. 5 = $FillPopup, <count>, <selected> { , <values> }
  154.  
  155. Fill the top-right popup with the given values. <count> is the number of values. <selected>, is one of the values, indicating which value should be initially selected in the popup. 
  156.  
  157. 6 = $FillList, <count> { , <values> }
  158.  
  159. This command fills the hash list. <count> is the number of values. A value will be selected if one corressponds to the current contents of the text field.
  160.  
  161. 7 = $SetText, <value>
  162.  
  163. Set the text field to the given value. If possible, a value in the hash-list will be selected that corressponds to this text value.
  164.  
  165. 8 = $AddRow { , <values> }
  166.  
  167. Add a row to the end of the list box. The number of values given must equal the number of columns in the list box.
  168.  
  169. 9 = $DelRow
  170.  
  171. Deletes the current row in the list-box. The current row depends on the users current selection but may also be selected with the $PickRow command.
  172.  
  173. 10 = $SetCol, <col>, <value>
  174.  
  175. Set a particular column in the current row to the given value.
  176.  
  177. 11 = $SetWindow, <name>
  178.  
  179. Set the current window. The name of the window must be specified. This allows an event executing in a one window to output data into the control fields of another window.
  180.  
  181. 12 = $PickRow, <row>
  182.  
  183. Set the current row in the list-box. If <row> is zero, then no row will be selected. The selected row is highlighted.
  184.  
  185. 13 = $PickCol, <col>
  186.  
  187. Set the current column. The selected column is indicated in the top-left popup.
  188.  
  189. 14 = $Alert, <which>, <message>, <count> { , <buttons> }
  190.  
  191. Display an Alert for the user. <which> determines the type of alert, as follows:
  192.  
  193. 1 = Stop Alert
  194. 2 = Caution Alert
  195. 3 = Note Alert
  196.  
  197. <message> is the message that is to be displayed by the alert. <count> is the number of buttons (1, 2, or 3), and this is folled by the titles of the buttons. The first button is the default.
  198.  
  199. NOTE: An alert should be the last action of the event, because the #ALERT event occurs immediattly after the alert.
  200.  
  201. 15 = $Progress, <perc>, <comment>, <cancel>
  202.  
  203. Displays a progress window. <perc> is the percentage complete (value from zero to 100). <comment> is the comment that should currently appear in the progress window, and <cancel> is set to 1 if the Cancel button should be enabled, else set to zero.
  204.  
  205. 16 = $Debug, <value>
  206.  
  207. Output a value to the debug window.
  208.  
  209. 17 = $Stop
  210.  
  211. Stop execution of the current event.
  212.  
  213. 18 = $Halt
  214.  
  215. Quit the Tabler application, unconditionally!
  216.  
  217.  
  218.  
  219.  
  220.  
  221.  
  222.